﻿<UserControl x:Class="Gat.Controls.MessageBoxView"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:local="clr-namespace:Gat.Controls"
			 xmlns:frmwrk="clr-namespace:Gat.Controls.Framework"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
			 mc:Ignorable="d"
			 MaxWidth="500"
			 MinWidth="300"
			 d:DesignHeight="300"
			 d:DesignWidth="300">
	<UserControl.Resources>
		<local:MessageBoxViewModel x:Key="ViewModel"
								   ShowMessageBoxEventHandler="OnShow"
								   CloseMessageBoxEventHandler="OnClose" />
		<frmwrk:VisibilityConverter x:Key="VisibilityConverter" />
	</UserControl.Resources>

	<Grid DataContext="{Binding Source={StaticResource ViewModel}}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<Grid Grid.Row="0"
			  Height="Auto"
			  Margin="10">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>

			<Image x:Name="Image"
				   Grid.Column="0"
				   Width="42"
				   Height="42"
				   Source="{Binding Image}" />
			<TextBlock x:Name="Message"
					   Grid.Column="1"
					   Grid.Row="0"
					   Margin="20"
					   TextWrapping="Wrap"
					   Text="{Binding Message}" />
		</Grid>

		<Grid Grid.Row="1"
			  Background="LightGray">
			<UniformGrid Rows="1"
						 MinHeight="45"
						 HorizontalAlignment="Right">
				<Button x:Name="Ok"
						Margin="10"
						MinWidth="100"
						Content="{Binding Ok}"
						Visibility="{Binding OkVisibility, Converter={StaticResource VisibilityConverter}}"
						IsDefault="{Binding IsOkDefault}"
						Command="{Binding OkCommand}" />
				<Button x:Name="Yes"
						Margin="10"
						MinWidth="100"
						Content="{Binding Yes}"
						Visibility="{Binding YesVisibility, Converter={StaticResource VisibilityConverter}}"
						IsDefault="{Binding IsYesDefault}"
						Command="{Binding YesCommand}" />
				<Button x:Name="No"
						Margin="10"
						MinWidth="100"
						Content="{Binding No}"
						Visibility="{Binding NoVisibility, Converter={StaticResource VisibilityConverter}}"
						IsDefault="{Binding IsNoDefault}"
						Command="{Binding NoCommand}" />
				<Button x:Name="Cancel"
						Margin="10"
						Content="{Binding Cancel}"
						Visibility="{Binding CancelVisibility, Converter={StaticResource VisibilityConverter}}"
						IsDefault="{Binding IsCancelDefault}"
						IsCancel="True"
						Command="{Binding CancelCommand}" />
			</UniformGrid>
		</Grid>
	</Grid>
</UserControl>
